<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

<!-- layui -->
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="/layer/layer.css" />
<script src="/layer/jquery-3.6.0.min.js"></script>
<script src="/layer/layer.js"></script>
<script src="${pageContext.request.contextPath }/layui/layui.js"></script>
<!-- layui -->

<SCRIPT language="JavaScript" src="/js/check_addZcInfo.js"></SCRIPT>
<script language="JavaScript" src="/js/setday.js"></script>
</head>

<body>

	<fieldset class="layui-elem-field">
		<legend>资产信息添加</legend>
		<div class="layui-field-box">
			<div class="layui-form"></div>
		</div>
	</fieldset>
	<form id="formId" style="width: 800px; padding-top: 20px"
		class="layui-form" action="/addzc" method="post">
		<div class="layui-form-item">
			<label class="layui-form-label">资产编号</label>
			<div class="layui-input-block">
				<input type="text" value="${zs.zcId}" name="zcId" required
					lay-verify="required" placeholder="请输入内容" autocomplete="off"
					class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">资产型号</label>
			<div class="layui-input-block">
				<input type="text" name="zcNo" value="${zs.zcNo}" required
					lay-verify="required" placeholder="请输入内容" autocomplete="off"
					class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">资产名称</label>
			<div class="layui-input-block">
				<input type="text" value="${zs.zcName}" name="zcName" required
					lay-verify="required" placeholder="请输入内容" autocomplete="off"
					class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">生产日期</label>
			<div class="layui-input-block">
				<input type="text" name="zcProducetime" value="${zs.zcProducetime}"
					id="date1" lay-verify="date" placeholder="yyyy-MM-dd"
					autocomplete="off" class="layui-input">

			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">单价</label>
			<div class="layui-input-block">
				<input type="text" name="zcPrice" value="${zs.zcPrice}" required
					lay-verify="required" placeholder="请输入内容(RMB)" autocomplete="off"
					class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">生产厂商</label>
			<div class="layui-input-block">
				<input type="text" name="zcFactory" value="${zs.zcFactory}" required
					lay-verify="required" placeholder="请输入内容" autocomplete="off"
					class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">入库时间</label>
			<div class="layui-input-block">
				<input type="text" name="zcBuytime" value="${zs.zcBuytime}"
					id="date2" lay-verify="date" placeholder="yyyy-MM-dd"
					autocomplete="off" class="layui-input">

			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">购买人</label>
			<div class="layui-input-block">
				<input type="text" name="zcBuyer" value="${zs.zcBuyer}" required
					lay-verify="required" placeholder="请输入内容" autocomplete="off"
					class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">资产类型</label>
			<div class="layui-input-block">
				<select name="zcType" lay-verify="required">
					<option value="办公用品"
						<c:if test="${zs.zcType=='办公用品'}">selected</c:if>>办公用品</option>
					<option value="笔记本"
						<c:if test="${zs.zcType=='笔记本'}">selected</c:if>>笔记本</option>
					<option value="电脑软件"
						<c:if test="${zs.zcType=='电脑软件'}">selected</c:if>>电脑软件</option>
					<option value="电脑硬件"
						<c:if test="${zs.zcType=='电脑硬件'}">selected</c:if>>电脑硬件</option>
					<option value="服务器"
						<c:if test="${zs.zcType=='服务器'}">selected</c:if>>服务器</option>
					<option value="手机通信"
						<c:if test="${zs.zcType=='手机通信'}">selected</c:if>>手机通信</option>
					<option value="数码产品"
						<c:if test="${zs.zcType=='数码产品'}">selected</c:if>>数码产品</option>
					<option value="数码配件"
						<c:if test="${zs.zcType=='数码配件'}">selected</c:if>>数码配件</option>
					<option value="拓展配件"
						<c:if test="${zs.zcType=='拓展配件'}">selected</c:if>>拓展配件</option>
					<option value="网络设备"
						<c:if test="${zs.zcType=='网络设备'}">selected</c:if>>网络设备</option>
					<option value="无线网络"
						<c:if test="${zs.zcType=='无线网络'}">selected</c:if>>无线网络</option>
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">资产状态</label>
			<div class="layui-input-block">
				<select name="zcStatus">
					<option value="正常"
						<c:if test="${zs.zcStatus=='正常'}">selected</c:if>>正常</option>
					<option value="维修"
						<c:if test="${zs.zcStatus=='维修'}">selected</c:if>>维修</option>
					<option value="借出"
						<c:if test="${zs.zcStatus=='借出'}">selected</c:if>>借出</option>
					<option value="报废"
						<c:if test="${zs.zcStatus=='报废'}">selected</c:if>>报废</option>
				</select>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">部门信息</label>
			<div class="layui-input-block">
				<input type="text" name="zcBzxx" value="${zs.zcBzxx}" required
					lay-verify="required" placeholder="请输入内容" autocomplete="off"
					class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
				<button type="button" onclick="window.history.back();"
					class="layui-btn layui-btn-primary">返回上一级</button>
			</div>
		</div>

	</form>

	<!-- 111 -->

	<script>
		var $;
		layui.use([ 'form', 'laydate', 'jquery' ], function() {
			var form = layui.form;
			var laydate = layui.laydate;
			$ = layui.jquery;
			//日期
			laydate.render({
				elem : '#date1'
			});
			laydate.render({
				elem : '#date2'
			});
			//监听提交
			form.on('submit(formDemo)', function(data) {

				//Ajax提交
				$.ajax({
					url : "addzc",
					context : document.body,
					type : 'post',
					data : JSON.stringify(data.field),
					contentType : 'application/json',
					success : function(result) {
						if (result == 'error') {
							layer.msg('资产编号不允许重复!', {
								time : 1000, //1s后自动关闭
							});
						} else {
							layer.msg('添加成功! 即将跳转上一页...', {
								time : 1000, //1s后自动关闭
							});
							setTimeout(function() {
								window.location.href = result;
							}, 1000);
						}

					},
					error : function(xhr, status, error) {
						layer.msg('资产编号不允许重复!', {
							time : 1000, //1s后自动关闭
						});
					}
				});
				return false;
			});

		});
	</script>


</body>
</html>
